<?php
defined ( 'IN_TS' ) or die ( 'Access Denied.' );

// 列表
$page = isset ( $_GET ['page'] ) ? intval ( $_GET ['page'] ) : 1;
$url = tsUrl ( 'article', 'index', array (
		'page' => '' 
) );
$lstart = $page * 15 - 15;

$arrArticles = $new ['article']->findAll ( 'article', array (
		'isaudit' => '0' 
), 'addtime desc', '', $lstart . ',15' );

$articleNum = $new ['article']->findCount ( 'article', array (
		'isaudit' => '0' 
) );

$pageUrl = pagination ( $articleNum, 15, $page, $url );

foreach ( $arrArticles as $key => $item ) {
	$arrArticle [] = $item;
	$arrArticle [$key]['title'] = tsTitle($item['title']);
	$arrArticle [$key] ['user'] = aac ( 'user' )->getOneUser ( $item ['userid'] );
	$arrArticle [$key] ['group'] = $new ['article']->find ( 'group', array (
			'groupid' => $item ['groupid']
	) );
	$arrArticle[$key]['abs'] = cututf8 ( t(tsDecode($item ['content'])), 0, 80 );
	if(!$arrArticle[$key]['abs']){
		$img_path =getTextPhotos(tsDecode($item ['content']));
		if($img_path){
			$arrArticle[$key]['abs']='<img width="100%" src="'.$img_path[0].'">';
		}
	}
}
/*
// 推荐阅读
$arrRecommend = $new ['article']->getRecommendArticle ();

// 一周热门
$arrHot7 = $new ['article']->getHotArticle ( 7 );
// 一月热门
$arrHot30 = $new ['article']->getHotArticle ( 30 );
*/

$sitekey = $TS_APP['appkey'];
$sitedesc = $TS_APP['appdesc'];
$title = '文档';

include template ( 'index' );